From: Roan Kattouw Date: Mon, 4 May 2009 14:51:46 +0000 (+0000) Subject: (bug 18677) Give proper error message when viewing &action=protect without sufficient... X-Git-Tag: 1.31.0-rc.0~41888 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=a21650b8252a03d310dd72dcc4bf4be201486446;p=lhc%2Fweb%2Fwiklou.git (bug 18677) Give proper error message when viewing &action=protect without sufficient rights. Patch by Stefano Codari --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3f91fa6433..19ced84c12 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -111,6 +111,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Fixed the circular template inclusion check, was broken when the loop involved redirects. Without this, infinite recursion within the parser is possible. +* (bug 18677) Give proper error message when viewing &action=protect without + sufficient rights == API changes in 1.16 == diff --git a/includes/Article.php b/includes/Article.php index 1f30e8797f..f10eafd4b2 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1962,6 +1962,16 @@ class Article { * action=protect handler */ public function protect() { + global $wgUser, $wgOut; + + # Check permissions + $permission_errors = $this->mTitle->getUserPermissionsErrors( 'protect', $wgUser ); + + if( count( $permission_errors ) > 0 ) { + $wgOut->showPermissionsErrorPage( $permission_errors ); + return; + } + $form = new ProtectionForm( $this ); $form->execute(); }